const exportData = function (url, from) {
  let temp = document.createElement('form')
  temp.action = url
  temp.method = 'post'
  temp.style.display = 'none'
  if (from) {
    for (let i in from) {
      let opt = document.createElement('input')
      opt.name = i
      opt.value = from[i]
      temp.appendChild(opt)
    }
  }
  document.body.appendChild(temp)
  temp.submit()
  setTimeout(() => {
    document.body.removeChild(temp)
  }, 300)
}

export default exportData
